function ajaxFileUpload(filename) {
	if ($('#image' + filename).val() == null
			|| $('#image' + filename).val() == "") {
		$("#" + filename + "loading").ajaxStart(function() {
					$(this).show();
				}).ajaxComplete(function() {
					$(this).hide();
				});

		$.ajaxFileUpload({
					url : '${ctx }/upload.do?method=upload' + filename,
					secureuri : false,
					fileElementId : filename,
					dataType : 'json',
					success : function(data, status) {
						if (typeof(data.error) != 'undefined') {
							if (data.error != '') {
								alert(data.error);
							}
						} else {
							alert(data.msg);
							$('#' + filename).attr('disabled', true);
							if (data.inputname == 'file1') {
								$('#imagefile1').val(encodeURI(data.filename));
							}
							if (data.inputname == 'file2') {
								$('#imagefile2').val(encodeURI(data.filename));
							}
							if (data.inputname == 'file3') {
								$('#imagefile3').val(encodeURI(data.filename));
							}
							if (data.inputname == 'file4') {
								$('#imagefile4').val(encodeURI(data.filename));
							}
							if (data.inputname == 'file5') {
								$('#imagefile5').val(encodeURI(data.filename));
							}
							if (data.inputname == 'file6') {
								$('#imagefile6').val(encodeURI(data.filename));
							}
							if (data.inputname == 'file7') {
								$('#imagefile7').val(encodeURI(data.filename));
							}
							if (data.inputname == 'file8') {
								$('#imagefile8').val(encodeURI(data.filename));
							}
						}
					},
					error : function(data, status, e) {
						alert(e);
					}
				})
		return false;
	}
}